package com.weiyuwqj.server.service.reward.impl;

import com.github.pagehelper.PageHelper;
import com.weiyuwqj.api.service.BasTicketService;
import com.weiyuwqj.server.service.base.BaseServiceImpl;
import com.weiyuwqj.api.common.PageList;
import com.weiyuwqj.api.common.Paginator;
import com.weiyuwqj.server.mapper.BasTicketMapper;
import com.weiyuwqj.api.model.BasTicket;
import com.weiyuwqj.api.model.vo.BasTicketVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * Created by zhangyong on 2016/8/9.
 */
@Service("ticketService")
public class BasTicketServiceImpl  extends BaseServiceImpl<BasTicket> implements BasTicketService {

    @Autowired
    BasTicketMapper ticketMapper;

    @Override
    public PageList getList(Paginator p,Map map) {
        PageHelper.startPage(p.getPageNum(), p.getPageSize());
        return new PageList(ticketMapper.getList(map));
    }

    @Override
    public List<BasTicketVo> getList(Map map) {
        return ticketMapper.getList(map);
    }

    @Override
    public BasTicketVo getSingle(Integer id) {
        return ticketMapper.getSingle(id);
    }

    //前台投资根据金额对应能使用的加息券列表
    @Override
    public List<BasTicket> getListByUserId(Map map) {
        return ticketMapper.getListByUserId(map);
    }

    @Override
    public int updateTicketTimerStatus(Map map) {
        return ticketMapper.updateTicketTimerStatus(map);
    }

    @Override
    public PageList listTicketAndConf(Paginator p, Map map) {
        PageHelper.startPage(p.getPageNum(),p.getPageSize());
        List<BasTicketVo> list =ticketMapper.listTicketAndConf(map);
        return new PageList(list);
    }
}
